﻿<?php
if(!defined('IN_PHPSCUP'))exit('hacking'); 
class OrderApp extends BaseApp
{
    function index()
    {
		$GLOBALS['Lang']->_get_lang('order');	
		require(ROOT_PATH . '/lib/nav.lib.php');
		
		$nav = new Nav($GLOBALS['SCup']->SCup_nav_file);
		
        $this->assign('navigation', $nav->_get_nav());	
        $pic_data = include(ROOT_PATH . '/data/cache/rollpic_'.trim($GLOBALS['Lang']->_lang_tp).'.php'); 
		$this->assign('pic_data', $pic_data);	
			
	 	$categorydata = & $GLOBALS['SCup']->_get_category_data('prot');
		
        $this->assign('data',array('company'=>'','name'=>'','sex'=>'','telphone'=>'','cellphone'=>'','address'=>'','email'=>'','content'=>''));
        $this->assign('url_id','');				
        $this->assign('categorydata', $categorydata);	
        $this->assign('langdata', $GLOBALS['Lang']->_get_lang_typesdata());	 	    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', SITE_TITLE);
        $this->assign('page_description', SITE_DESCRIPTION);
        $this->assign('page_keywords', SITE_KEYWORDS);		
		$this->assign('bg_pic_url',$GLOBALS['SCup']->SCup_name.'/view/'.VIEW_TYPE .'/style/'.CSS_TYPE.'/');
        $this->assign('login_icon', $GLOBALS['SCup']->SCup_user_checking);	        $this->assign('langtype', trim($GLOBALS['Lang']->_lang_tp));
	        $this->assign('site_url',SITE_URL);
		
        $this->display('order.view.html');
    }

    function orderlist()
    {
		$GLOBALS['Lang']->_get_lang('order');
		
		require(ROOT_PATH . '/lib/nav.lib.php');
		
		$nav = new Nav($GLOBALS['SCup']->SCup_nav_file);
		
        $this->assign('navigation', $nav->_get_nav());	
        $pic_data = include(ROOT_PATH . '/data/cache/rollpic_'.trim($GLOBALS['Lang']->_lang_tp).'.php'); 
		$this->assign('pic_data', $pic_data);			
		
        $this->assign('langdata', $GLOBALS['Lang']->_get_lang_typesdata());	 		
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', SITE_TITLE);
        $this->assign('page_description', SITE_DESCRIPTION);
        $this->assign('page_keywords', SITE_KEYWORDS);				
        $this->assign('login_icon', $GLOBALS['SCup']->SCup_user_checking);
		$this->assign('bg_pic_url',$GLOBALS['SCup']->SCup_name.'/view/'.VIEW_TYPE .'/style/'.CSS_TYPE.'/');		

				
		$TB_leaveword = &$this->_model('order'); 
				
		$data = $TB_leaveword->show($GLOBALS['SCup']->SCup_user_msg['user_id']);	
	
		
        $this->assign('lw_data', $data['data']);		
		$this->assign('lw_page', $data['page']); 				
        $this->assign('langtype', trim($GLOBALS['Lang']->_lang_tp));
	        $this->assign('site_url',SITE_URL);			
		
        $this->display('roderlist.view.html');      


    }	
	
    function post()
    {
		$data = array();
		
		$data = $_POST['data'];
		
		$data['user_id'] = $GLOBALS['SCup']->SCup_user_msg['user_id'];
				
		$TB_leaveword = &$this->_model('order'); 
		if(!$TB_leaveword->post($data))
		{		 
		    $notice = &get_message(array('msg'=>'False!','url'=>'','title'=>'Notice'));
		    $notice ->display();
		 
		}			
		
		if($data['user_id'])
		{
		    $this->orderlist();
		}
		else
		{
		    $notice = &get_message(array('msg'=>'Scucess!','url'=>'','title'=>'Notice'));
		    $notice ->display();
		
		}
		
         		      

    }

    function edit()
    {
	
		$GLOBALS['Lang']->_get_lang('order');	
	
		$id= intval($_GET['id']);


		require(ROOT_PATH . '/lib/nav.lib.php');
		
		$nav = new Nav($GLOBALS['SCup']->SCup_nav_file);
		
        $this->assign('navigation', $nav->_get_nav());	
        $pic_data = include(ROOT_PATH . '/data/cache/rollpic_'.trim($GLOBALS['Lang']->_lang_tp).'.php'); 
		$this->assign('pic_data', $pic_data);	

	 	$categorydata = & $GLOBALS['SCup']->_get_category_data('prot');
		
        $this->assign('categorydata', $categorydata);	
		
		$TB_leaveword = &$this->_model('order'); 
				
		$data = $TB_leaveword->editshow($GLOBALS['SCup']->SCup_user_msg['user_id'],$id);		

        $this->assign('data', $data);
		
	    $this->assign('url_id', $id);
        $this->assign('langdata', $GLOBALS['Lang']->_get_lang_typesdata());	 								
        $this->assign('categorydata', $categorydata);	
	    
        $this->assign('view_charset', VIEW_CHARSET);	
        $this->assign('page_title', SITE_TITLE);
        $this->assign('page_description', SITE_DESCRIPTION);
        $this->assign('page_keywords', SITE_KEYWORDS);		
		$this->assign('bg_pic_url',$GLOBALS['SCup']->SCup_name.'/view/'.VIEW_TYPE .'/style/'.CSS_TYPE.'/');
        $this->assign('login_icon', $GLOBALS['SCup']->SCup_user_checking);	        $this->assign('langtype', trim($GLOBALS['Lang']->_lang_tp));
	        $this->assign('site_url',SITE_URL);
		
        $this->display('order.view.html');      

    }

    function editaction()
    {
		$id= intval($_POST['id']);
		
		$data = $_POST['data'];
   
		$TB_leaveword = &$this->_model('order'); 		
				
		$TB_leaveword->editaction($GLOBALS['SCup']->SCup_user_msg['user_id'],$id,$data);
			
		$this->orderlist();  	      

    }
	
	

    function del()
    {
		$id= intval($_GET['id']);		

		$TB_leaveword = &$this->_model('order'); 		
		$TB_leaveword->del($GLOBALS['SCup']->SCup_user_msg['user_id'],$id);
		      
        $this->orderlist();    
    }	
	
   
}




?>